#include "ChangeStateButton.h"


ChangeStateButton::ChangeStateButton(const char aPosition, const char *aName, State &aState) {
    this->theYPosition = aPosition;
    this->theName = aName;
    this->theState = &aState;
}

ChangeStateButton::~ChangeStateButton() {
}

void ChangeStateButton::run(Frame &aFrame, Event &anEvent) {
    if(this->theYPosition == anEvent.getY()) {
        aFrame.changeState( *(this->theState) );
    }
}

string ChangeStateButton::toString() {
    return this->theName;
}
